import request from '../utils/request'

export const userRegisterService = (data) => {
    return request.post('/user/register',data)
}

export const userLoginService = (data) => {
    return request.post('/user/login', data)
}


export const getUserDataService = () => {
    return request.get('/user/userInfo')
}

export const updateUserInfoService = (data) => {
    return request.put('/user/update', data)
}


export const updatePasswordService = (data) => {
    return request.patch('/user/updatePassword', data)
}

export const userAvatarUpdateService = (avatarUrl) => {
    const urlSearchParams = new URLSearchParams();
    urlSearchParams.append('avatarUrl', avatarUrl)
    return request.patch('/user/updateAvatar', urlSearchParams)
  }